package com.jsu.task;

import java.util.TimerTask;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.jsu.bean.FoundId;
import com.jsu.bean.LostId;
import com.jsu.dao.FoundMessageMapper;
import com.jsu.dao.LostMessageMapper;
import com.jsu.service.GetFoundFaceToken;
import com.jsu.service.GetLostFaceToken;
import com.jsu.service.LostMatchToFound;
@Component
public class LostTask{

	@Autowired
	LostMessageMapper lostMessageMapper;
	@Autowired
	GetLostFaceToken getLostFaceToken;
	@Autowired
	LostMatchToFound lostMatchToFound;
	
	
	//@Scheduled(fixedDelay = 10*1_000)
	public void run() {
		String photoBasic = "/root/lost/";
		LostId lostId = LostId.getInstance();
		Integer id = lostMessageMapper.selectLastId();
		if(id!=null){
			System.out.println("查询到id是"+id);
			int tmp = lostId.getMaxId();
			lostId.setCurrentId(tmp);
			if(id>tmp){
				lostId.setMaxId(id);
				getLostFaceToken.setTar(lostId, photoBasic);
				getLostFaceToken.run();
				lostMatchToFound.setTar(lostId, photoBasic);
				lostMatchToFound.run();
			}
		}
		
	}

}
